<%@page import="com.hamizhong.iflowers.web.vo.FlowerCountVO"%>
<%@page import="com.hamizhong.iflowers.web.vo.FlowerFloridVO"%>
<%@page import="com.hamizhong.iflowers.web.vo.TargetVO"%>
<%@page import="com.hamizhong.iflowers.web.vo.FestivalVO"%>
<%@page import="com.hamizhong.iflowers.web.vo.PurposeVO"%>
<%@page import="com.hamizhong.iflowers.web.vo.ColorVO"%>
<%@page import="com.hamizhong.iflowers.web.vo.VarietyVO"%>
<%@page import="java.util.List"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<%@include file="../common/common.jsp" %>
<link rel="stylesheet" href="<%=request.getContextPath() %>/css/index_lunbo.css">
<link rel="stylesheet" href="<%=request.getContextPath() %>/css/cat_slider.css">
<title>Hami鲜花-首页</title>
</head>

<%
	List<VarietyVO> myVarietyVOList = (List<VarietyVO>)request.getAttribute("myVarietyVOList");
	List<ColorVO> myColorVOList = (List<ColorVO>)request.getAttribute("myColorVOList");
	List<PurposeVO> myPurposeVOList = (List<PurposeVO>)request.getAttribute("myPurposeVOList");
	List<FestivalVO> myFestivalVOList = (List<FestivalVO>)request.getAttribute("myFestivalVOList");
	List<TargetVO> myTargetVOList = (List<TargetVO>)request.getAttribute("myTargetVOList");
	List<FlowerFloridVO> myFlowerFloridVOList = (List<FlowerFloridVO>)request.getAttribute("myFlowerFloridVOList");
	List<FlowerCountVO> myFlowerCountVOList = (List<FlowerCountVO>)request.getAttribute("myFlowerCountVOList");
%>

<script type="text/javascript">
	$(function() {
		//初始化首页商品
		//--arg1 折扣专区
		//--arg2 精品推荐
		initIndexGoods(5,10);
	});
	
	function initIndexGoods(onSaleCnt,commonCnt) {
		$.ajax({
			url: '<%=request.getContextPath() %>/ajaxInitIndexGoods.action',
			data: {
				'onSaleCnt': onSaleCnt,
				'commonCnt':commonCnt
			},
			type: 'post',
			dataType: 'json',
			async: false,
			success: ajaxInitIndexGoods_Callback
		});
	}
	function ajaxInitIndexGoods_Callback(res) {
		var rs = res.result;
		if(rs == 0) {
			var data = res.data;
			var data2 = res.data2;
			var dataHtml = '';
			var dataHtml2 = '';
			if(data.length > 0) {
				for(var i=0;i<data.length;i++) {
					dataHtml += '<div style="width: 175px;height: 240px;float: left;margin: 10px;border: 1px solid #DDD;">'+
									'<div style="width: 170px;height: 170px;margin: 2px;">'+
										'<a target="_blank" href="<%=request.getContextPath() %>/goodsItem.action?goodsId='+data[i].goodsId+'"><img width="170px" height="170px" alt="" src="<%=request.getContextPath() %>/'+data[i].goodsPictureS+'"></a>'+
									'</div>'+
									'<div style="width: 170px;height: 30px;line-height: 30px;margin: 2px;margin-top: 10px;text-align: center;">'+
										'<a target="_blank" href="<%=request.getContextPath() %>/goodsItem.action?goodsId='+data[i].goodsId+'">'+data[i].goodsName+'</a>'+
									'</div>'+
									'<div style="width: 170px;height: 25px;line-height: 25px;text-align: center;color: #FF4326;font-weight: bold;">'+
										'<font style="color: #CCC;">￥'+data[i].goodsPrice+'&nbsp;/&nbsp;</font>'+'￥'+data[i].barginPrice+
									'</div>'+
								'</div>';
				}
				$('#barginGoodsDiv').html(dataHtml);
			}
			if(data2.length > 0) {
				for(var i=0;i<data2.length;i++) {
					dataHtml2 += '<div style="width: 175px;height: 240px;float: left;margin: 10px;border: 1px solid #DDD;">'+
									'<div style="width: 170px;height: 170px;margin: 2px;">'+
										'<a target="_blank" href="<%=request.getContextPath() %>/goodsItem.action?goodsId='+data2[i].goodsId+'"><img width="170px" height="170px" alt="" src="<%=request.getContextPath() %>/'+data2[i].goodsPictureS+'"></a>'+
									'</div>'+
									'<div style="width: 170px;height: 30px;line-height: 30px;margin: 2px;margin-top: 10px;text-align: center;">'+
										'<a target="_blank" href="<%=request.getContextPath() %>/goodsItem.action?goodsId='+data2[i].goodsId+'">'+data2[i].goodsName+'</a>'+
									'</div>';
					if(data2[i].isBargin == 1) {
						dataHtml2 += '<div style="width: 170px;height: 25px;line-height: 25px;text-align: center;color: #FF4326;font-weight: bold;">'+
										'<font style="color: #CCC;">￥'+data[i].goodsPrice+'&nbsp;/&nbsp;</font>'+'￥'+data[i].barginPrice+
									'</div>';
					}else {
						dataHtml2 += '<div style="width: 170px;height: 25px;line-height: 25px;text-align: center;color: #FF4326;font-weight: bold;">'+
										'￥'+data2[i].goodsPrice+
									'</div>';
					}
					dataHtml2 += '</div>';
				}
				$('#commonGoodsDiv').html(dataHtml2);
			}
		}else {
			alert(res.msg);
		}
	}
</script>

<body>
	<%@include file="frame/top.jsp" %>
	<div class="main_div">
		<%@include file="frame/navigation.jsp" %>
		<div style="width: 990px;height: auto;margin: 0 auto;overflow: hidden;">
			<!-- 分类 -->
			<div style="width: 220px;height: 375px;float: left;border: 1px solid #CCC;">
				<div class="cat_sidebar" style="height: 250px;">
					<ul class="cat_submain">
						<h2 style="background: none repeat scroll 0 0 #FF4326;color: #FFFFFF;font-size: 14px;font-weight: bold;height: 27px;line-height: 27px;padding: 0 10px;margin-bottom: 10px;">
							<font style="margin-left: 10px;">全部商品分类</font>
						</h2>
						<li onmouseout="unshow_divb(this);" onmouseover="show_divb(this);">
							<a href="#" onfocus="this.blur();">新鲜花材</a>
							<div class="small">
								<%
									for(int i=0;i<myVarietyVOList.size();i++) {
										VarietyVO varietyVO = myVarietyVOList.get(i);
								%>
									<a href="<%=request.getContextPath() %>/goodsSearchByType.action?varietyId=<%=varietyVO.getVarietyId() %>" onfocus="this.blur();"><%=varietyVO.getVarietyName() %></a>
								<%
									}
								%>
							</div>
						</li>
						<li onmouseout="unshow_divb(this);" onmouseover="show_divb(this);">
							<a href="#" onfocus="this.blur();">鲜花颜色</a>
							<div class="small">
								<%
									for(int i=0;i<myColorVOList.size();i++) {
										ColorVO colorVO = myColorVOList.get(i);
								%>
									<a href="<%=request.getContextPath() %>/goodsSearchByType.action?colorId=<%=colorVO.getColorId() %>" onfocus="this.blur();"><%=colorVO.getColorName() %></a>
								<%
									}
								%>
							</div>
						</li>
						<li onmouseout="unshow_divb(this);" onmouseover="show_divb(this);">
							<a href="#" onfocus="this.blur();">鲜花用途</a>
							<div class="small">
								<%
									for(int i=0;i<myPurposeVOList.size();i++) {
										PurposeVO purposeVO = myPurposeVOList.get(i);
								%>
									<a href="<%=request.getContextPath() %>/goodsSearchByType.action?purposeId=<%=purposeVO.getPurposeId() %>" onfocus="this.blur();"><%=purposeVO.getPurposeName() %></a>
								<%
									}
								%>
							</div>
						</li>
						<li onmouseout="unshow_divb(this);" onmouseover="show_divb(this);">
							<a href="#" onfocus="this.blur();">节日分类</a>
							<div class="small">
								<%
									for(int i=0;i<myFestivalVOList.size();i++) {
										FestivalVO festivalVO = myFestivalVOList.get(i);
								%>
									<a href="<%=request.getContextPath() %>/goodsSearchByType.action?festivalId=<%=festivalVO.getFestivalId() %>" onfocus="this.blur();"><%=festivalVO.getFestivalName() %></a>
								<%
									}
								%>
							</div>
						</li>
						<li onmouseout="unshow_divb(this);" onmouseover="show_divb(this);">
							<a href="#" onfocus="this.blur();">赠送对象</a>
							<div class="small">
								<%
									for(int i=0;i<myTargetVOList.size();i++) {
										TargetVO targetVO = myTargetVOList.get(i);
								%>
									<a href="<%=request.getContextPath() %>/goodsSearchByType.action?targetId=<%=targetVO.getTargetId() %>" onfocus="this.blur();"><%=targetVO.getTargetName() %></a>
								<%
									}
								%>
							</div>
						</li>
						<li onmouseout="unshow_divb(this);" onmouseover="show_divb(this);">
							<a href="#" onfocus="this.blur();">花语含义</a>
							<div class="small">
								<%
									for(int i=0;i<myFlowerFloridVOList.size();i++) {
										FlowerFloridVO flowerFloridVO = myFlowerFloridVOList.get(i);
								%>
									<a href="<%=request.getContextPath() %>/goodsSearchByType.action?flowerFloridId=<%=flowerFloridVO.getFlowerFloridId() %>" onfocus="this.blur();"><%=flowerFloridVO.getFlowerFloridName() %></a>
								<%
									}
								%>
							</div>
						</li>
						<li onmouseout="unshow_divb(this);" onmouseover="show_divb(this);">
							<a href="#" onfocus="this.blur();">成花支数</a>
							<div class="small">
								<%
									for(int i=0;i<myFlowerCountVOList.size();i++) {
										FlowerCountVO flowerCountVO = myFlowerCountVOList.get(i);
								%>
									<a href="<%=request.getContextPath() %>/goodsSearchByType.action?flowerCountId=<%=flowerCountVO.getFlowerCountId() %>" onfocus="this.blur();"><%=flowerCountVO.getFlowerCountName() %></a>
								<%
									}
								%>
							</div>
						</li>
					</ul>
				</div>
				<div style="width: 100%;height: 100px;padding: 10px;">
					<img width="200px" alt="" src="<%=request.getContextPath() %>/images/pages/client/menu_buttom_ad.gif">
				</div>
			</div>
			<!-- 轮播图 -->
			<div style="float: right">
				<div class="main">
					<div class="slides">
						<ul class="slide-pic">
							<li class="" style="display: none">
								<a href="<%=request.getContextPath() %>/goodsSearchByType.action?festivalId=QMJ">
									<img src="<%=request.getContextPath() %>/images/pages/client/lunbo/lunbo1.jpg" alt="" width="657" height="375">
								</a>
							</li>
							<li style="display: list-item;" class="cur">
								<a href="<%=request.getContextPath() %>/goodsSearchByType.action?varietyId=MG">
									<img src="<%=request.getContextPath() %>/images/pages/client/lunbo/lunbo2.jpg" alt="" width="657" height="375">
								</a>
							</li>
							<li style="display: none;" class="">
								<a href="<%=request.getContextPath() %>/goodsSearchByType.action?purposeId=SR">
									<img src="<%=request.getContextPath() %>/images/pages/client/lunbo/lunbo3.jpg" alt="" width="659" height="375">
								</a>
							</li>
							<li style="display: none;" class="">
								<a href="<%=request.getContextPath() %>/goodsSearchByType.action">
									<img src="<%=request.getContextPath() %>/images/pages/client/lunbo/lunbo4.jpg" alt="" width="659" height="375">
								</a>
							</li>
						</ul>
						<ul class="slide-li op">
							<li class=""></li>
							<li class="cur"></li>
							<li class=""></li>
							<li class=""></li>
						</ul>
						<ul class="slide-li slide-txt">
							<li class="">
								<a href="<%=request.getContextPath() %>/goodsSearchByType.action?festivalId=QMJ">清明时节</a>
							</li>
							<li class="cur">
								<a href="<%=request.getContextPath() %>/goodsSearchByType.action?varietyId=MG">玫瑰之约</a>
							</li>
							<li class="">
								<a href="<%=request.getContextPath() %>/goodsSearchByType.action?purposeId=SR">生日快乐</a>
							</li>
							<li class="">
								<a href="<%=request.getContextPath() %>/goodsSearchByType.action">花艺学堂</a>
							</li>

						</ul>
					</div>
				</div>
				<script src="<%=request.getContextPath() %>/js/lunbo.js" type="text/javascript"></script>
			</div>
		</div>
		<div style="clear: both;width: 100%;height: 10px;"></div>
		<div style="width: 990px;height: auto;margin: 0 auto;overflow: hidden;">
			<div style="width: 100%;height: 30px;line-height: 30px;background: none repeat scroll 0 0 #EFEFEF;border: 1px solid #CCCCCC;">
				<font style="font-weight: bold;margin-left: 5px;">折扣专区</font>
			</div>
			<div id="barginGoodsDiv" style="width: 988px;height: 260px;border: 1px solid #CCC;border-top: 0;">

			</div>
		</div>
		<div style="clear: both;width: 100%;height: 10px;"></div>
		<div style="width: 990px;height: auto;margin: 0 auto;overflow: hidden;">
			<div style="width: 100%;height: 30px;line-height: 30px;background: none repeat scroll 0 0 #EFEFEF;border: 1px solid #CCCCCC;">
				<font style="font-weight: bold;margin-left: 5px;">精品推荐</font>
			</div>
			<div id="commonGoodsDiv" style="width: 988px;height: 520px;border: 1px solid #CCC;border-top: 0;">

			</div>
		</div>
	</div>
	<%@include file="frame/feet2.jsp" %>
</body>

<script type="text/javascript">
	function show_div(strid) {
		strid.getElementsByTagName('a')[0].className = 'on';
		strid.style.position = "relative";
	}
	function show_divb(strid) {
		strid.getElementsByTagName('a')[0].className = 'onb';
		strid.getElementsByTagName('div')[0].style.display = "block";
		strid.style.position = "relative";
	}
	function show_divc(strid) {
		strid.getElementsByTagName('a')[0].className = 'onc';
		strid.style.position = "relative";
	}
	function unshow_div(strid) {
		strid.getElementsByTagName('a')[0].className = '';
		strid.style.position = "";
	}
	function unshow_divb(strid) {
		strid.getElementsByTagName('a')[0].className = '';
		strid.getElementsByTagName('div')[0].style.display = "";
		strid.style.position = "";
	}
</script>

</html>